﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Devfw.OpenAuth;

namespace Devfw.OpenAuth.Platform
{
    public abstract class ProviderBase
    {
        protected OpenAuthCore _core = null;
        static ProviderBase()
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 512;
        }

        public ProviderBase( string oauth_consumer_key, string oauth_consumer_secret )
            : this( oauth_consumer_key, oauth_consumer_secret, "1.0", SignatureType.HMACSHA1, AuthorizationType.UrlQuery )
        {            
        }

        public ProviderBase( string oauth_consumer_key, string oauth_consumer_secret, string version, SignatureType signatureType, AuthorizationType authorizationType )
        {
            _core = new Devfw.OpenAuth.OpenAuthCore( oauth_consumer_key, oauth_consumer_secret, "1.0", signatureType, authorizationType );
        }

        public ProviderBase( string oauth_consumer_key, string oauth_consumer_secret, string oauth_token, string oauth_token_secret )
            : this( oauth_consumer_key, oauth_consumer_secret, oauth_token, oauth_token_secret, "1.0", SignatureType.HMACSHA1, AuthorizationType.HttpAuthorizationHeader )
        {            
        }

        public ProviderBase( string oauth_consumer_key, string oauth_consumer_secret, string oauth_token, string oauth_token_secret, string version, SignatureType signatureType, AuthorizationType authorizationType )
        {
            _core = new Devfw.OpenAuth.OpenAuthCore( oauth_consumer_key, oauth_consumer_secret );
            OAuthToken = oauth_token;
            OAuthTokenSecret = oauth_token_secret;
        }

        public string OAuthToken
        {
            get;
            set;
        }

        public string OAuthTokenSecret
        {
            get;
            set;
        }
    }
}
